package com.ruoyi.base.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.base.domain.BaseTask;
import com.ruoyi.base.domain.BaseTrayMat;
import com.ruoyi.base.mapper.BaseTaskMapper;
import com.ruoyi.base.mapper.BaseTrayMatMapper;
import com.ruoyi.base.service.IBaseTaskService;
import com.ruoyi.base.service.IBaseTrayMatService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseTrayMatServiceImpl extends ServiceImpl<BaseTrayMatMapper, BaseTrayMat> implements IBaseTrayMatService {
    @Autowired
    private BaseTrayMatMapper baseTrayMatMapper;

    /**
     * 查询托盘货品
     *
     * @param id 托盘货品主键
     * @return 托盘货品
     */
    @Override
    public BaseTrayMat selectBaseTrayMatById(Long id)
    {
        return baseTrayMatMapper.selectBaseTrayMatById(id);
    }

    /**
     * 查询托盘货品列表
     *
     * @param baseTrayMat 托盘货品
     * @return 托盘货品
     */
    @Override
    public List<BaseTrayMat> selectBaseTrayMatList(BaseTrayMat baseTrayMat)
    {
        return baseTrayMatMapper.selectBaseTrayMatList(baseTrayMat);
    }

    /**
     * 新增托盘货品
     *
     * @param baseTrayMat 托盘货品
     * @return 结果
     */
    @Override
    public int insertBaseTrayMat(BaseTrayMat baseTrayMat)
    {
        baseTrayMat.setCreateTime(DateUtils.getNowDate());
        return baseTrayMatMapper.insertBaseTrayMat(baseTrayMat);
    }

    /**
     * 修改托盘货品
     *
     * @param baseTrayMat 托盘货品
     * @return 结果
     */
    @Override
    public int updateBaseTrayMat(BaseTrayMat baseTrayMat)
    {
        baseTrayMat.setUpdateTime(DateUtils.getNowDate());
        return baseTrayMatMapper.updateBaseTrayMat(baseTrayMat);
    }

    /**
     * 批量删除托盘货品
     *
     * @param ids 需要删除的托盘货品主键
     * @return 结果
     */
    @Override
    public int deleteBaseTrayMatByIds(Long[] ids)
    {
        return baseTrayMatMapper.deleteBaseTrayMatByIds(ids);
    }

    /**
     * 删除托盘货品信息
     *
     * @param id 托盘货品主键
     * @return 结果
     */
    @Override
    public int deleteBaseTrayMatById(Long id)
    {
        return baseTrayMatMapper.deleteBaseTrayMatById(id);
    }

    @Override
    public List<BaseTrayMat> getByBomId(Long id) {
        return baseTrayMatMapper.getByBomId(id);
    }
}
